CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
sagemathinc

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/next/pages/software/python/[name].tsx
Views: 687
1
/*
2
* This file is part of CoCalc: Copyright © 2021 Sagemath, Inc.
3
* License: MS-RSL – see LICENSE.md for details
4
*/
5
6
import { Alert, Layout } from "antd";
7
8
import { SoftwareEnvNames } from "@cocalc/util/consts/software-envs";
9
import Footer from "components/landing/footer";
10
import Head from "components/landing/head";
11
import Header from "components/landing/header";
12
import Image from "components/landing/image";
13
import SoftwareLibraries from "components/landing/software-libraries";
14
import { Paragraph, Title } from "components/misc";
15
import A from "components/misc/A";
16
import { Customize, CustomizeType } from "lib/customize";
17
import { ExecutableDescription } from "lib/landing/render-envs";
18
import { withCustomizedAndSoftwareSpec } from "lib/landing/software-specs";
19
import {
20
ComputeComponents,
21
ComputeInventory,
22
ExecInfo,
23
SoftwareSpec,
24
} from "lib/landing/types";
25
import { STYLE_PAGE, STYLE_PAGE_WIDE } from "..";
26
import pythonScreenshot from "/public/features/frame-editor-python.png";
27
28
interface Props {
29
name: SoftwareEnvNames;
30
customize: CustomizeType;
31
spec: SoftwareSpec["python"];
32
inventory: ComputeInventory["python"];
33
components: ComputeComponents["python"];
34
execInfo?: ExecInfo;
35
timestamp: string;
36
}
37
38
export default function Software(props: Props) {
39
const { name, customize, spec, inventory, components, execInfo, timestamp } =
40
props;
41
42
function renderBox() {
43
return (
44
<Alert
45
style={{ margin: "15px 0" }}
46
message="Learn More"
47
description={
48
<span style={{ fontSize: "10pt" }}>
49
Learn more about{" "}
50
<strong>
51
<A href="/features/python">Python in CoCalc</A>
52
</strong>{" "}
53
and{" "}
54
<strong>
55
<A href="/features/jupyter-notebook">Jupyter Notebook support</A>
56
</strong>
57
.
58
</span>
59
}
60
type="info"
61
showIcon
62
/>
63
);
64
}
65
66
function renderIntro() {
67
return (
68
<>
69
<Title level={1} style={{ textAlign: "center" }}>
70
Installed Python Libraries (Ubuntu {name})
71
</Title>
72
<div style={{ width: "50%", float: "right", padding: "0 0 15px 15px" }}>
73
<Image
74
src={pythonScreenshot}
75
alt="Writing and running a Python program"
76
/>
77
</div>
78
<Paragraph>
79
The table below lists pre-installed Python libraries for each
80
supported environment, which are immediately available in every CoCalc
81
project running on the default "Ubuntu {name}" image. If something is
82
missing, you can{" "}
83
<A href="https://doc.cocalc.com/howto/install-python-lib.html">
84
install it yourself
85
</A>
86
, or request that we install it.
87
</Paragraph>
88
</>
89
);
90
}
91
92
// top part has the same with, the table is wider
93
function renderTop() {
94
return (
95
<div style={{ maxWidth: STYLE_PAGE.maxWidth, margin: "0 auto" }}>
96
{renderIntro()}
97
{renderBox()}
98
<h2 style={{ clear: "both" }}>Python Environments</h2>
99
<ExecutableDescription spec={spec} execInfo={execInfo} />
100
</div>
101
);
102
}
103
104
return (
105
<Customize value={customize}>
106
<Head title="Python Libraries in CoCalc" />
107
<Layout>
108
<Header page="software" subPage="python" softwareEnv={name} />
109
<Layout.Content
110
style={{
111
backgroundColor: "white",
112
}}
113
>
114
<div style={STYLE_PAGE_WIDE}>
115
{renderTop()}
116
<SoftwareLibraries
117
spec={spec}
118
timestamp={timestamp}
119
inventory={inventory}
120
components={components}
121
libWidthPct={40}
122
/>
123
</div>
124
<Footer />
125
</Layout.Content>
126
</Layout>
127
</Customize>
128
);
129
}
130
131
export async function getServerSideProps(context) {
132
return await withCustomizedAndSoftwareSpec(context, "python");
133
}
134
135